const express = require('express')

const multer = require('multer')

const path = require('path')

const mysql = require('mysql')

//连接数库
var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'lolheromsg'
});

//创建一个服务器
const server = express()

//创建一个文件夹用来存放用户提交的数据
var upload = multer({
    dest: path.join(__dirname, 'www', 'uploads/')
})

// 暴露www文件夹
server.use(express.static('www'))

//传过来的是文本，需要处理一下才能使用req.body
server.use(express.urlencoded({
    extended: false
}))



//监听7000端口
server.listen(7000, () => {

    console.log('7000端口开启');
})